//
//  DeviceInfo.h
//  MusicAnalyzer
//
//  Created by jiro on 12/03/23.
//  Copyright 2012 jiro music. All rights reserved.
//

#import <string>
#import <sstream>

namespace sc
{

class DeviceInfo
{
public:

	enum Type
	{
		Type_Device		= 0x0001,

		Type_UsbDevice	= Type_Device | 0x0002,
		
		Type_MidiDevice	= Type_Device | 0x0004,

		Type_UsbMidiDevice = Type_Device | Type_UsbDevice | Type_MidiDevice, 
				
		Type_None = 0x0000,
	};

private:

	Type type;

public:

	DeviceInfo()
		: type( Type_Device )
	{}

	virtual ~DeviceInfo() {}
	
	virtual bool IsUsbDevice() const { return false; }

	virtual bool IsMidiDevice() const { return false; }

	Type GetType() const { return type; }

	static std::string GetTypeName( Type type )
	{
		switch ( type )
		{
		case Type_Device:
			return "Device";

		case Type_UsbDevice:
			return "UsbDevice";
		
		case Type_MidiDevice:
			return "MidiDevice";

		case Type_UsbMidiDevice:
			return "UsbMidiDevice";
		}
		return "Unknown";
	}

	virtual std::string ToString( int tabCount = 0 ) const
	{
		std::string tabs;
		for ( int i = 0; i < tabCount; i++) 
		{
			tabs.append( "\t" );
		}
		std::stringstream ss;
		ss << "DeviceInfo: type: " << GetTypeName( type );
		return ss.str();
	}


protected:

	void SetType( Type typeArg ) { type = typeArg; }

};


}